package com.woniuxy.dudugua.test;

import com.woniuxy.dudugua.entity.Category;
import com.woniuxy.dudugua.entity.Store;
import com.woniuxy.dudugua.service.CategoryService;
import com.woniuxy.dudugua.service.StoreService;
import com.woniuxy.dudugua.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("testadd")
public class AddProduct {
    @Autowired
    private CategoryService categoryService;
    @Autowired
    private StoreService storeService;
    @RequestMapping("getonetype")
    public Result getOneType(){
        List<Category> oneType = categoryService.getOneType();
        return new Result("200","success",null,oneType);
    }
    @RequestMapping("getchildtype")
    public Result getChildType(int id){
        List<Category> childType = categoryService.getChildType(id);
        return new Result("200","success",null,childType);
    }
    @RequestMapping("getallstore")
    public Result getStore(){
        List<Store> all = storeService.getAll();
        return new Result("200","success",null,all);
    }


}
